package com.leigq.www.mybatisplusstudy.domain.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.leigq.basaltools.bean.Response;
import com.leigq.www.mybatisplusstudy.domain.entity.Department;
import com.leigq.www.mybatisplusstudy.domain.service.IDepartmentService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 部门 Controller
 * </p>
 *
 * @author leigq
 * @since 2019-06-14
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/departments")
public class DepartmentController {

    private final IDepartmentService departmentService;

    /**
     * 查询所有部门
     *
     * @author ：LeiGQ <br>
     * @date ：2019-06-14 14:25 <br>
     * <p>
     */
    @GetMapping("/list")
    public Response<IPage<Department>> listDepartments(Page<Department> page) {
        return Response.success(departmentService.listDepartments(page));
    }

}
